def sumOfNumber(number)
	sum = 0
	number.to_s.split("").each do |digitString|
		sum += digitString.to_i(10)
	end
	sum
end

num1 = 1
num2 = 1
sum = 0
(1..100).each do |number1|
	(1..100).each do |number2|
		sumOfNumber = sumOfNumber(number1 ** number2);
		if sumOfNumber > sum
			num1 = number1
			num2 = number2
			sum = sumOfNumber
		end
	end
end

puts num1
puts num2
puts num1 ** num2
puts sum